﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ItemManager
{
    public partial class frmMain : Form
    {

        frmList formList = new frmList();       // Initialized in frmMain_Load() so we can position it

        public frmMain()
        {
            InitializeComponent();
        }

        private void menuFileExit_Click(object sender, EventArgs e)
        {
            // This warning will only be for when there are unsaved changes.
            if (MessageBox.Show("Are you sure you want to exit?", "Item Manager", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void menuViewList_Click(object sender, EventArgs e)
        {
            if(menuViewList.Checked == true)
            {
                // Hide the form but don't destroy it.
                formList.Visible = false;
            }
            else
            {
                // Show the form with this as parent
                formList.Show(this);
            }

            // Update the check accordingly
            menuViewList.Checked = !menuViewList.Checked;
        }
    }
}
